function initQueryGrid() {
	querDataGrid = $('#querDataGrid').datagrid({
		url : host + 'moduleAction/getModuleQueryList.html',
		fit : true,
		fitColumns : true,
		border : false,
		pagination : false,
		checkOnSelect : false,
		selectOnCheck : false,
		nowrap : false,
		rownumbers: true,
		frozenColumns: [],
		columns : [[{
			field : 'tableName',
			title : '表名',
			width : 60
		}, {
			field : 'name',
			title : '标题',
			width : 60
		}, {
			field : 'fieldName',
			title : '字段',
			width : 60
		}, {
			field : 'type',
			title : '类型',
			width : 60
		}, {
			field : 'isHide',
			title : '是否隐藏',
			width : 60,
			formatter: function(value, row, index) {
				return value == 1 ? "是" : " 否";
			}
		}, {
			field : 'id',
			title : '操作',
			width : 50,
			formatter : function(value, row, index) {
					 return "<a href='javascript: void(0)' onclick='editQuery(\"" + value + "\", \"" + row.tableName + "\")'>修改</a>&nbsp;"+
							"<a href='javascript: void(0)' onclick='deleteQuery(\"" + value + "\")'>删除</a>"; 
			}
		}]],
		toolbar: [{text: "<span style='font-weight: bold;'>查询条件<span>"}, "-", {
			id: "queryAddBtn",
			text : '新增',
			disabled: true,
			iconCls : 'icon-add',
			handler : function() {
				batchImportQuery();
			}
		}]
	});
}
function editQuery(id, tableName) {
	dialog = baseJs.window(host + "system/setting/module/editQuery.html?id=" + id + "&tableName=" + tableName, {
		title: "编辑查询信息", width: 780, height: 380
	});
}
function deleteQuery(id) {
	baseJs.confirm("确定提示", "确定删除此查询条件？", function(r) {
		if (r) {
			$.post(host + "moduleAction/deleteQuery.html", {"id": id}, function(data) {
				if (data.status == "ok") {
					querDataGrid.datagrid('reload');
				}
				alert(data.msg);
			}, "json");
		}
	});
}
function batchImportQuery() {
	dialog = baseJs.window(host + "system/setting/module/importField.html?type=query&moduleId=" + selectedRow.id, {
		title: "导入查询信息", width: 600, height: 510
	});
}